package com.wang.lottery.interfaces;


import com.wang.lottery.domain.activity.model.po.Activity;
import com.wang.lottery.infrastucture.mapper.ActivityMapper;
import com.wang.lottery.rpc.IActivityBooth;
import com.wang.lottery.rpc.dto.ActivityDto;
import com.wang.lottery.rpc.req.ActivityReq;
import com.wang.lottery.rpc.res.ActivityRes;
import org.apache.dubbo.config.annotation.Service;

import javax.annotation.Resource;

/**
 * @author wjh
 * @create 2023-08-21 14:17
 * 活动展台
 */
@Service
public class ActivityBooth implements IActivityBooth {
    @Resource
    ActivityMapper activityDao;


    @Override
    public ActivityRes queryActivityById(ActivityReq req) {
        Activity activity = activityDao.queryActivityById(req.getActivityId());
        ActivityRes activityRes = new ActivityRes();
        ActivityDto activityDto = new ActivityDto();
        activityDto.setActivityId(activity.getActivityId());
        activityDto.setActivityName(activity.getActivityName());
        activityDto.setActivityDesc(activity.getActivityDesc());
        activityDto.setBeginDateTime(activity.getBeginDateTime());
        activityDto.setEndDateTime(activity.getEndDateTime());
        activityDto.setStockCount(activity.getStockCount());
        activityDto.setTakeCount(activity.getTakeCount());
        activityRes.setActivity(activityDto);

        return activityRes;
    }
}
